﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Drawing.Imaging;
using System.Drawing;
using System.IO;
using iTextSharp.text.pdf;
using iTextSharp.text;
using System.Configuration;
using System.Text;

public partial class Views_GetImageText : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        string fileName = Server.MapPath("~/Images/test.jpg");
        //string outputFileName = Server.MapPath("~/Images/test.pdf");        
        string outputFileName = Server.MapPath("~/Images/test-01.jpg");

        if (File.Exists(outputFileName))
        {
            File.Delete(outputFileName);
        }

        System.Drawing.Image image = System.Drawing.Image.FromFile(fileName);
        Graphics g = Graphics.FromImage(image);

        //Document document = new Document();

        //try
        //{       

        //    //PdfWriter pdfWriter = PdfWriter.GetInstance(document, new FileStream(outputFileName, FileMode.CreateNew));
        //    //document.Open();

        //    //string fontPath = ConfigurationManager.AppSettings["PdfDocumentFont"];
        //    //BaseFont font = BaseFont.CreateFont(fontPath, BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);
        //    iTextSharp.text.Image itextImage = iTextSharp.text.Image.GetInstance(fileName);
            
        //    document.Add(itextImage);
        //    document.Close();
        //}
        //finally
        //{
        //    document.Dispose();
        //}
    }

    
}